//
//  WeatherTableViewCellFour.m
//  ToWhere
//
//  Created by dllo on 15/11/16.
//  Copyright © 2015年 www.TE.com. All rights reserved.
//

#import "WeatherTableViewCellFour.h"

@implementation WeatherTableViewCellFour
- (void)dealloc
{
    [_windlabel release];
    [_windeImage release];
    [_windBtn release];
    [_humidityBtn release];
    [_humidityImage release];
    [_humiditylabel release];
    [_dic release];
    [super dealloc];
}
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{

    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.windBtn = [UIButton buttonWithType:UIButtonTypeCustom];
        self.windBtn.backgroundColor = [[UIColor blackColor]colorWithAlphaComponent:0.45];
        [self.contentView addSubview:_windBtn];

        self.windeImage = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"weather_fengli"]];
        [self.contentView addSubview:self.windeImage];
        [_windeImage release];
        self.windlabel = [[UILabel alloc] init];
        self.windlabel.font = [UIFont systemFontOfSize:17 *kWidth];
        self.windlabel.textAlignment = NSTextAlignmentCenter;
        self.windlabel.textColor = [UIColor whiteColor];
        [self.contentView addSubview:_windlabel];
        [_windlabel release];
        
        self.humidityBtn = [UIButton buttonWithType:UIButtonTypeCustom];
        self.humidityBtn.backgroundColor = [[UIColor blackColor]colorWithAlphaComponent:0.45];
        [self.contentView addSubview:_humidityBtn];
        
        self.humidityImage = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"weather_shidu"]];
        [self.contentView addSubview:_humidityImage];
        [_humidityImage release];
        
        self.humiditylabel = [[UILabel alloc] init];
        self.humiditylabel.font = [UIFont systemFontOfSize:17 *kWidth];
        self.humiditylabel.textAlignment = NSTextAlignmentCenter;
        self.humiditylabel.textColor = [UIColor whiteColor];
        [self.contentView addSubview:_humiditylabel];
        [_humiditylabel release];
        
    }
    return self;
}
- (void)layoutSubviews{

    self.windBtn.frame = CGRectMake(0, 0, 186 *kWidth, 100 *kHeight);
    self.windeImage.frame = CGRectMake(70 *kWidth, 10 *kHeight, 40 *kWidth, 40 *kHeight);
    self.windlabel.frame = CGRectMake(0, 60 *kHeight, 186 *kWidth, 30 *kHeight);
    
    self.humidityBtn.frame = CGRectMake(189 *kWidth, 0, 186 *kWidth, 100 *kHeight);
    self.humidityImage.frame = CGRectMake(199 *kWidth + 60 *kWidth, 10 *kHeight, 40 *kWidth, 40 *kHeight);
    self.humiditylabel.frame = CGRectMake(189 *kWidth , 60 *kHeight, 186 *kWidth, 30);
}
- (void)setDic:(NSDictionary *)dic{

    self.windlabel.text = [NSString stringWithFormat:@"%@ %@",[dic objectForKey:@"wd"],[dic objectForKey:@"ws"]];
    self.humiditylabel.text = [NSString stringWithFormat:@"湿度%@ ％",[dic objectForKey:@"sd"]];

}
+ (WeatherTableViewCellFour *)weatherTableViewCellFourWithTableView:(UITableView *)tableView{

    static NSString *weatherTableViewCellFour = @"weatherTableViewCellFour";
    WeatherTableViewCellFour *cell = [tableView dequeueReusableCellWithIdentifier:weatherTableViewCellFour];
    if (!cell ) {
        cell = [[WeatherTableViewCellFour alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:weatherTableViewCellFour];
    }
    return cell;
}
@end
